#ifdef dontcompilethis
#include <iostream>

#include "CellCoordinate.h"
#include "PathCoordinate.h"
#include "SiteCoordinate.h"
#include "Cell.h"
#include "Path.h"
#include "Site.h"
#include "GameMap.h"
#include "CoordinateX.h"
#include "CoordinateY.h"
#include "HorizontalCardinal.h"
#include "VerticalCardinal.h"
#include "CatanClassContractException.h"

using namespace catan;

bool testCellCoordinate()
{
	bool testPass;
	bool cellExpectedResult[7][7] = {
			{false, false, false,  true,  true,  true,  true},
			{false, false,  true,  true,  true,  true,  true},
			{false,  true,  true,  true,  true,  true,  true},
			{ true,  true,  true,  true,  true,  true,  true},
			{ true,  true,  true,  true,  true,  true, false},
			{ true,  true,  true,  true,  true, false, false},
			{ true,  true,  true,  true, false, false, false}
	};
	std::cout << "CellCoordinate:" << std::endl;
	std::cout << "canInit __init_ getters" << std::endl;
	bool cellCoordinatePass = true;
	for (int j=0; j<=6; ++j)
	{
		for (int i=0; i<=6; ++i)
		{
			testPass = (cellExpectedResult[j][i] == CellCoordinate::canInit(CoordinateX(static_cast<CoordinateX::Enum_CoordinateX>(i)), CoordinateY(static_cast<CoordinateY::Enum_CoordinateY>(j))));
			std::cout << testPass;
			cellCoordinatePass = cellCoordinatePass && testPass;
		}
		std::cout << " ";
		for (int i=0; i<=6; ++i)
		{
			try
			{
				CellCoordinate cellCoordinate(CoordinateX(static_cast<CoordinateX::Enum_CoordinateX>(i)), CoordinateY(static_cast<CoordinateY::Enum_CoordinateY>(j)));
				testPass = (cellExpectedResult[j][i] == true);
			}
			catch (CatanClassContractException)
			{
				testPass = (cellExpectedResult[j][i] == false);
			}
			std::cout << testPass;
			cellCoordinatePass = cellCoordinatePass && testPass;
		}
		std::cout << " ";
		for (int i=0; i<=6; ++i)
		{
			try
			{
				CellCoordinate cellCoordinate(CoordinateX(static_cast<CoordinateX::Enum_CoordinateX>(i)), CoordinateY(static_cast<CoordinateY::Enum_CoordinateY>(j)));
				testPass = (cellExpectedResult[j][i] == true && cellCoordinate.getCoordinateX().getEnum() == i && cellCoordinate.getCoordinateY().getEnum() == j);
			}
			catch (CatanClassContractException)
			{
				testPass = (cellExpectedResult[j][i] == false);
			}
			std::cout << testPass;
			cellCoordinatePass = cellCoordinatePass && testPass;
		}
		std::cout << std::endl;
	}
	std::cout << std::endl;
	std::cout << (cellCoordinatePass ? "Success!" : "Failure!") << std::endl;
	return cellCoordinatePass;
}

bool testPathCoordinate()
{
	bool testPass;
	bool pathExpectedResult[6][7][7] = {
			{ /*TR*/
			{false, false, false, false, false, false, false},
			{false, false, false,  true,  true,  true, false},
			{false, false,  true,  true,  true,  true, false},
			{false,  true,  true,  true,  true,  true, false},
			{ true,  true,  true,  true,  true, false, false},
			{ true,  true,  true,  true, false, false, false},
			{ true,  true,  true, false, false, false, false}
			},
			{ /*TC*/
			{false, false, false, false, false, false, false},
			{false, false, false,  true,  true,  true, false},
			{false, false,  true,  true,  true,  true, false},
			{false,  true,  true,  true,  true,  true, false},
			{false,  true,  true,  true,  true,  true, false},
			{false,  true,  true,  true,  true, false, false},
			{false,  true,  true,  true, false, false, false}
			},
			{ /*TL*/
			{false, false, false, false, false, false, false},
			{false, false, false,  true,  true,  true,  true},
			{false, false,  true,  true,  true,  true,  true},
			{false,  true,  true,  true,  true,  true,  true},
			{false,  true,  true,  true,  true,  true, false},
			{false,  true,  true,  true,  true, false, false},
			{false, false, false, false, false, false, false}
			},
			{ /*BL*/
			{false, false, false, false,  true,  true,  true},
			{false, false, false,  true,  true,  true,  true},
			{false, false,  true,  true,  true,  true,  true},
			{false,  true,  true,  true,  true,  true, false},
			{false,  true,  true,  true,  true, false, false},
			{false,  true,  true,  true, false, false, false},
			{false, false, false, false, false, false, false}
			},
			{ /*BC*/
			{false, false, false,  true,  true,  true, false},
			{false, false,  true,  true,  true,  true, false},
			{false,  true,  true,  true,  true,  true, false},
			{false,  true,  true,  true,  true,  true, false},
			{false,  true,  true,  true,  true, false, false},
			{false,  true,  true,  true, false, false, false},
			{false, false, false, false, false, false, false}
			},
			{ /*BR*/
			{false, false, false, false, false, false, false},
			{false, false,  true,  true,  true,  true, false},
			{false,  true,  true,  true,  true,  true, false},
			{ true,  true,  true,  true,  true,  true, false},
			{ true,  true,  true,  true,  true, false, false},
			{ true,  true,  true,  true, false, false, false},
			{false, false, false, false, false, false, false}
			}
	};
	int pathTransformResult[6][3] = {
			{ 0,  0,  30},
			{ 0, -1, 270},
			{ 0,  0, 150},
			{-1,  1,  30},
			{ 0,  0, 270},
			{ 1,  0, 150}
	};
	std::cout << "PathCoordinate:" << std::endl;
	std::cout << "canInit: TR      TC      TL      BL      BC      BR" << std::endl;
	bool pathCoordinatePass = true;
	for (int j=0; j<=6; ++j)
	{
		CoordinateY::Enum_CoordinateY y = static_cast<CoordinateY::Enum_CoordinateY>(j);
		std::cout << "         ";
		for (int k=0; k<=5; ++k)
		{
			VerticalCardinal::Enum_VerticalCardinal cardinal = static_cast<VerticalCardinal::Enum_VerticalCardinal>(k*60+30);
			for (int i=0; i<=6; ++i)
			{
				CoordinateX::Enum_CoordinateX x = static_cast<CoordinateX::Enum_CoordinateX>(i);
				testPass = (pathExpectedResult[k][j][i] == PathCoordinate::canInit(CoordinateX(x), CoordinateY(y), VerticalCardinal(cardinal)));
				std::cout << testPass;
				pathCoordinatePass = pathCoordinatePass && testPass;
			}
			std::cout << " ";
		}
		std::cout << std::endl;
	}
	std::cout << std::endl;
	std::cout << "__init_: TR      TC      TL      BL      BC      BR" << std::endl;
	for (int j=0; j<=6; ++j)
	{
		CoordinateY y(static_cast<CoordinateY::Enum_CoordinateY>(j));
		std::cout << "         ";
		for (int k=0; k<=5; ++k)
		{
			VerticalCardinal cardinal(static_cast<VerticalCardinal::Enum_VerticalCardinal>(k*60+30));
			for (int i=0; i<=6; ++i)
			{
				CoordinateX x(static_cast<CoordinateX::Enum_CoordinateX>(i));
				try
				{
					PathCoordinate pathCoordinate(x, y, cardinal);
					testPass = (pathExpectedResult[k][j][i] == true);
				}
				catch (CatanClassContractException)
				{
					testPass = (pathExpectedResult[k][j][i] == false);
				}
				std::cout << testPass;
				pathCoordinatePass = pathCoordinatePass && testPass;
			}
			std::cout << " ";
		}
		std::cout << std::endl;
	}
	std::cout << std::endl;
	std::cout << "shiftin: TR TC TL BL BC BR" << std::endl;
	std::cout << "       ";
	for (int k=0; k<=5; ++k)
	{
		VerticalCardinal::Enum_VerticalCardinal cardinal = static_cast<VerticalCardinal::Enum_VerticalCardinal>(k*60+30);
		try
		{
			PathCoordinate pathCoordinate(catan::x3, catan::y3, VerticalCardinal(cardinal));
			testPass = (
					(pathCoordinate.getCoordinateX().getEnum() == static_cast<CoordinateX::Enum_CoordinateX>(3 + pathTransformResult[k][0])) &&
					(pathCoordinate.getCoordinateY().getEnum() == static_cast<CoordinateY::Enum_CoordinateY>(3 + pathTransformResult[k][1])) &&
					(pathCoordinate.getVerticalCardinal().getEnum() == static_cast<VerticalCardinal::Enum_VerticalCardinal>(pathTransformResult[k][2]))
					);
		}
		catch (char const*)
		{
			testPass = false;
		}
		std::cout << "  " << testPass;
		pathCoordinatePass = pathCoordinatePass && testPass;
	}
	std::cout << std::endl;
	std::cout << (pathCoordinatePass ? "Success!" : "Failure!") << std::endl;
	return pathCoordinatePass;
}

bool testSiteCoordinate()
{
	bool testPass;
	bool siteExpectedResult[6][7][7] = {
			{ /*CR*/
			{false, false, false, false, false, false, false},
			{false, false,  true,  true,  true,  true, false},
			{false,  true,  true,  true,  true,  true, false},
			{ true,  true,  true,  true,  true,  true, false},
			{ true,  true,  true,  true,  true, false, false},
			{ true,  true,  true,  true, false, false, false},
			{ true,  true,  true, false, false, false, false}
			},
			{ /*TR*/
			{false, false, false, false, false, false, false},
			{false, false, false,  true,  true,  true, false},
			{false, false,  true,  true,  true,  true, false},
			{false,  true,  true,  true,  true,  true, false},
			{ true,  true,  true,  true,  true,  true, false},
			{ true,  true,  true,  true,  true, false, false},
			{ true,  true,  true,  true, false, false, false}
			},
			{ /*TL*/
			{false, false, false, false, false, false, false},
			{false, false, false,  true,  true,  true,  true},
			{false, false,  true,  true,  true,  true,  true},
			{false,  true,  true,  true,  true,  true,  true},
			{false,  true,  true,  true,  true,  true, false},
			{false,  true,  true,  true,  true, false, false},
			{false,  true,  true,  true, false, false, false}
			},
			{ /*CL*/
			{false, false, false, false,  true,  true,  true},
			{false, false, false,  true,  true,  true,  true},
			{false, false,  true,  true,  true,  true,  true},
			{false,  true,  true,  true,  true,  true,  true},
			{false,  true,  true,  true,  true,  true, false},
			{false,  true,  true,  true,  true, false, false},
			{false, false, false, false, false, false, false}
			},
			{ /*BL*/
			{false, false, false,  true,  true,  true,  true},
			{false, false,  true,  true,  true,  true,  true},
			{false,  true,  true,  true,  true,  true,  true},
			{false,  true,  true,  true,  true,  true, false},
			{false,  true,  true,  true,  true, false, false},
			{false,  true,  true,  true, false, false, false},
			{false, false, false, false, false, false, false}
			},
			{ /*BR*/
			{false, false, false,  true,  true,  true, false},
			{false, false,  true,  true,  true,  true, false},
			{false,  true,  true,  true,  true,  true, false},
			{ true,  true,  true,  true,  true,  true, false},
			{ true,  true,  true,  true,  true, false, false},
			{ true,  true,  true,  true, false, false, false},
			{false, false, false, false, false, false, false}
			}
	};
	int siteTransformResult[6][3] = {
			{ 0,  0,   0},
			{ 1, -1, 180},
			{-1,  0,   0},
			{ 0,  0, 180},
			{-1,  1,   0},
			{ 1,  0, 180}
	};
	std::cout << "SiteCoordinate:" << std::endl;
	std::cout << "canInit: CR      TR      TL      CL      BL      BR" << std::endl;
	bool siteCoordinatePass = true;
	for (int j=0; j<=6; ++j)
	{
		CoordinateY::Enum_CoordinateY y = static_cast<CoordinateY::Enum_CoordinateY>(j);
		std::cout << "         ";
		for (int k=0; k<=5; ++k)
		{
			HorizontalCardinal::Enum_HorizontalCardinal cardinal = static_cast<HorizontalCardinal::Enum_HorizontalCardinal >(k*60);
			for (int i=0; i<=6; ++i)
			{
				CoordinateX::Enum_CoordinateX x = static_cast<CoordinateX::Enum_CoordinateX>(i);
				testPass = (siteExpectedResult[k][j][i] == SiteCoordinate::canInit(CoordinateX(x), CoordinateY(y), HorizontalCardinal(cardinal)));
				std::cout << testPass;
				siteCoordinatePass = siteCoordinatePass && testPass;
			}
			std::cout << " ";
		}
		std::cout << std::endl;
	}
	std::cout << std::endl;
	std::cout << "__init_: CR      TR      TL      CL      BL      BR" << std::endl;
	for (int j=0; j<=6; ++j)
	{
		CoordinateY y(static_cast<CoordinateY::Enum_CoordinateY>(j));
		std::cout << "         ";
		for (int k=0; k<=5; ++k)
		{
			HorizontalCardinal cardinal(static_cast<HorizontalCardinal::Enum_HorizontalCardinal>(k*60));
			for (int i=0; i<=6; ++i)
			{
				CoordinateX x(static_cast<CoordinateX::Enum_CoordinateX>(i));
				try
				{
					SiteCoordinate siteCoordinate(x, y, cardinal);
					testPass = (siteExpectedResult[k][j][i] == true);
				}
				catch (CatanClassContractException)
				{
					testPass = (siteExpectedResult[k][j][i] == false);
				}
				std::cout << testPass;
				siteCoordinatePass = siteCoordinatePass && testPass;
			}
			std::cout << " ";
		}
		std::cout << std::endl;
	}
	std::cout << std::endl;
	std::cout << "shiftin: CR TR TL CL BL BR" << std::endl;
	std::cout << "       ";
	for (int k=0; k<=5; ++k)
	{
		HorizontalCardinal::Enum_HorizontalCardinal cardinal = static_cast<HorizontalCardinal::Enum_HorizontalCardinal>(k*60);
		try
		{
			SiteCoordinate siteCoordinate(catan::x3, catan::y3, HorizontalCardinal(cardinal));
			testPass = (
					(siteCoordinate.getCoordinateX().getEnum() == static_cast<CoordinateX::Enum_CoordinateX>(3 + siteTransformResult[k][0])) &&
					(siteCoordinate.getCoordinateY().getEnum() == static_cast<CoordinateY::Enum_CoordinateY>(3 + siteTransformResult[k][1])) &&
					(siteCoordinate.getHorizontalCardinal().getEnum() == static_cast<HorizontalCardinal::Enum_HorizontalCardinal>(siteTransformResult[k][2]))
					);
		}
		catch (CatanClassContractException)
		{
			testPass = false;
		}
		std::cout << "  " << testPass;
		siteCoordinatePass = siteCoordinatePass && testPass;
	}
	std::cout << std::endl;
	std::cout << (siteCoordinatePass ? "Success!" : "Failure!") << std::endl;
	return siteCoordinatePass;
}

bool testCell()
{
	bool testPass;
	std::cout << "Cell:" << std::endl;
	bool cellPass = true;
	char* typeTitles[13] = {
		"        Desert:  ",
		"        Forest:  ",
		"       Pasture:  ",
		"        Fields:  ",
		"         Hills:  ",
		"     Mountains:  ",
		"      Open Sea:  ",
		"General Harbor:  ",
		"   Wood Harbor:  ",
		"  Sheep Harbor:  ",
		"  Wheat Harbor:  ",
		"  Brick Harbor:  ",
		"    Ore Harbor:  "
	};
	bool cellExpectedResult[13][13] = {
			{false, false /*skipped*/, false, false, false, false, false,  true, false, false, false, false, false},  // Desert
			{false, false /*skipped*/,  true,  true,  true,  true,  true, false,  true,  true,  true,  true,  true},  // Forest
			{false, false /*skipped*/,  true,  true,  true,  true,  true, false,  true,  true,  true,  true,  true},  // Pasture
			{false, false /*skipped*/,  true,  true,  true,  true,  true, false,  true,  true,  true,  true,  true},  // Fields
			{false, false /*skipped*/,  true,  true,  true,  true,  true, false,  true,  true,  true,  true,  true},  // Hills
			{false, false /*skipped*/,  true,  true,  true,  true,  true, false,  true,  true,  true,  true,  true},  // Mountains
			{ true, false /*skipped*/, false, false, false, false, false, false, false, false, false, false, false},  // Open Sea
			{ true, false /*skipped*/, false, false, false, false, false, false, false, false, false, false, false},  // General Harbor
			{ true, false /*skipped*/, false, false, false, false, false, false, false, false, false, false, false},  // Wood Harbor
			{ true, false /*skipped*/, false, false, false, false, false, false, false, false, false, false, false},  // Sheep Harbor
			{ true, false /*skipped*/, false, false, false, false, false, false, false, false, false, false, false},  // Wheat Harbor
			{ true, false /*skipped*/, false, false, false, false, false, false, false, false, false, false, false},  // Brick Harbor
			{ true, false /*skipped*/, false, false, false, false, false, false, false, false, false, false, false}   // Ore Harbor
	};
	std::cout << "canInit:        None  2  3  4  5  6  7  8  9 10 11 12" << std::endl;
	for (int i=0; i<13; ++i)
	{
		CellType::Enum_CellType type = static_cast<CellType::Enum_CellType>(i);
		std::cout << typeTitles[i];
		for (int j=0; j<=12; ++j)
		{
			if (j==1)
			{
				continue;
			}
			CellNumber::Enum_CellNumber number = static_cast<CellNumber::Enum_CellNumber>(j);
			if (i <= 5)
			{
				testPass = (cellExpectedResult[i][j] == Cell::canInit(CellCoordinate(catan::x3, catan::y3), CellType(type), CellNumber(number)));
			}
			else
			{
				testPass = (cellExpectedResult[i][j] == Cell::canInit(CellCoordinate(catan::x3, catan::y0), CellType(type), CellNumber(number)));
			}
			std::cout << "  " << testPass;
			cellPass = cellPass && testPass;
		}
		std::cout << std::endl;
	}
	std::cout << std::endl;
	std::cout << "__init_:        None  2  3  4  5  6  7  8  9 10 11 12" << std::endl;
	for (int i=0; i<13; ++i)
	{
		CellType::Enum_CellType type = static_cast<CellType::Enum_CellType>(i);
		std::cout << typeTitles[i];
		for (int j=0; j<=12; ++j)
		{
			if (j==1)
			{
				continue;
			}
			CellNumber::Enum_CellNumber number = static_cast<CellNumber::Enum_CellNumber>(j);
			try
			{
				Cell cell = Cell(CellCoordinate(catan::x3, (i <= 5 ? catan::y3 : catan::y0)), CellType(type), CellNumber(number));
				testPass = (cellExpectedResult[i][j] == true);
			}
			catch (CatanClassContractException)
			{
				testPass = (cellExpectedResult[i][j] == false);
			}
			std::cout << "  " << testPass;
			cellPass = cellPass && testPass;
		}
		std::cout << std::endl;
	}
	std::cout << std::endl;
	std::cout << "getters:        None  2  3  4  5  6  7  8  9 10 11 12" << std::endl;
	for (int i=0; i<13; ++i)
	{
		CellType::Enum_CellType type = static_cast<CellType::Enum_CellType>(i);
		std::cout << typeTitles[i];
		for (int j=0; j<=12; ++j)
		{
			if (j==1)
			{
				continue;
			}
			CellNumber::Enum_CellNumber number = static_cast<CellNumber::Enum_CellNumber>(j);
			try
			{
				Cell cell = Cell(CellCoordinate(catan::x3, (i <= 5 ? catan::y3 : catan::y0)), CellType(type), CellNumber(number));
				testPass = (cell.getType().getEnum() == type && cell.getNumber().getEnum() == number);
			}
			catch (CatanClassContractException)
			{
				testPass = true;
			}
			std::cout << "  " << testPass;
			cellPass = cellPass && testPass;
		}
		std::cout << std::endl;
	}
	return cellPass;
}

bool testPath()
{
	bool testPass;
	std::cout << "Path:" << std::endl;
	bool pathPass = true;
	std::cout << "__init_: ";
	try
	{
		Path path(PathCoordinate(catan::x3, catan::y3, catan::verticalTR));
		testPass = true;
	}
	catch (char const*)
	{
		testPass = false;
	}
	std::cout << testPass;
	pathPass = pathPass && testPass;
	std::cout << std::endl;
	return pathPass;
}

bool testSite()
{
	bool testPass;
	std::cout << "Site:" << std::endl;
	bool sitePass = true;
	std::cout << "__init_: ";
	try
	{
		Site site(SiteCoordinate(catan::x3, catan::y3, catan::horizontalCR));
		testPass = true;
	}
	catch (char const*)
	{
		testPass = false;
	}
	std::cout << testPass;
	sitePass = sitePass && testPass;
	std::cout << std::endl;
	return sitePass;
}

bool testGameMap()
{
	bool testPass;
	std::cout << "GameMap:" << std::endl;
	bool gameMapPass = true;
	std::cout << "__init_: ";
	try
	{
		GameMap gameMap;
		testPass = true;
	}
	catch (char const*)
	{
		testPass = false;
	}
	std::cout << testPass;
	gameMapPass = gameMapPass && testPass;
	std::cout << std::endl;
	return gameMapPass;
}

int main(int argc, char **argv)
{
	bool cellCoordinatePass = testCellCoordinate();
	std::cout << std::endl;
	bool pathCoordinatePass = testPathCoordinate();
	std::cout << std::endl;
	bool siteCoordinatePass = testSiteCoordinate();
	std::cout << std::endl;
	bool cellPass = testCell();
	std::cout << std::endl;
	bool pathPass = testPath();
	std::cout << std::endl;
	bool sitePass = testSite();
	std::cout << std::endl;
	bool gameMapPass = testGameMap();

	std::cout << std::endl;
	std::cout << "Summary:" << std::endl;
	std::cout << "CellCoordinate: " << (cellCoordinatePass ? "Success!" : "Failure!") << std::endl;
	std::cout << "PathCoordinate: " << (pathCoordinatePass ? "Success!" : "Failure!") << std::endl;
	std::cout << "SiteCoordinate: " << (siteCoordinatePass ? "Success!" : "Failure!") << std::endl;
	std::cout << "          Cell: " << (cellPass ? "Success!" : "Failure!") << std::endl;
	std::cout << "          Path: " << (pathPass ? "Success!" : "Failure!") << std::endl;
	std::cout << "          Site: " << (sitePass ? "Success!" : "Failure!") << std::endl;
	std::cout << "       GameMap: " << (gameMapPass ? "Success!" : "Failure!") << std::endl;
	std::cout << std::endl;
	std::cout << " FINAL VERDICT: " << ((cellCoordinatePass && pathCoordinatePass && siteCoordinatePass && cellPass && pathPass && sitePass && gameMapPass) ? "SUCCESS!" : "FAILURE!") << std::endl;
	CoordinateX xx(static_cast<CoordinateX::Enum_CoordinateX>(3));
	CoordinateY yy(static_cast<CoordinateY::Enum_CoordinateY>(3));
	HorizontalCardinal hh(HorizontalCardinal::HORIZONTAL_BL);
	VerticalCardinal vv(VerticalCardinal::VERTICAL_BL);
	CellCoordinate cellB(catan::x3, catan::y3);
	//CellCoordinate cellC(CoordinateX::X3, CoordinateY::Y3);
	return 0;
}
#endif